package com.dao;

import com.mode.Analy;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description:
 * @author: sksun2
 * @create: 2023-03-15
 */
@Repository
public interface AnalyDao extends JpaRepository<Analy,Long> {

    // AND fixed_all is null
    @Query(value = "select * from analy where id > ?1 AND address !='-'  AND id <?2  limit 3000",nativeQuery = true)
    List<Analy> findByIdLimit(@Param("id") Long id,@Param("end") Long end);

    @Query(value = "select * from analy where address !='-' ",nativeQuery = true)
    List<Analy> findByAddressNot();

    @Query(value = "select * from analy where id < ?1 AND address !='-' AND fixed_all is null ORDER BY id desc  limit 3000 ",nativeQuery = true)
    List<Analy> findByIdLimitV2(@Param("id") Long id);

}
